{extend name='admin@main'}

{block name="button"}
<!--{if auth("store/goods/add")}-->
<button data-open='{:url("add")}' data-title="添加商品" class='layui-btn layui-btn-sm layui-btn-primary'>添加商品</button>
<!--{/if}-->
<!--{if auth("store/goods/remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除商品</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='goods/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap' width="10%">商品信息</th>
            <th class='text-left nowrap' width="10%">商品状态</th>
            <th class='text-left nowrap padding-0 relative' style="min-width:400px">
                <div class="layui-row" style="line-height:28px">
                    <div class="layui-col-xs6 text-center layui-elip">商品规格</div>
                    <div class="layui-col-xs3 text-center layui-elip">市价 / 售价</div>
                    <div class="layui-col-xs3 text-center layui-elip">库存 / 销量</div>
                </div>
            </th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
            <td class='list-table-sort-td'><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></td>
            <td class='text-left nowrap'>
                {notempty name='vo.logo'}
                <img data-tips-image style="width:60px;height:60px" src="{$vo.logo|default=''}" class="margin-right-5 text-top">
                {/notempty}
                <div class="inline-block">
                    商品编号：{$vo.id|default='--'}<br>
                    所属分类：{$vo.cate.title|default='--'}<br>
                    商品名称：{$vo.title|default='--'}<br>
                </div>
            </td>
            <td class='text-left nowrap'>
                快递费用：{$vo.price_express|default='0.00'} 元<br>
                分成比例：{$vo.price_rate+0} %<br>
                销售状态：{eq name='vo.status' value='0'}<span class="layui-badge">已下架</span>{else}<span class="layui-badge layui-bg-green">销售中</span>{/eq}<br>
            </td>
            <td class='text-left nowrap padding-0 relative'>
                <div style="overflow:auto;max-height:68px;padding:5px 0">
                    {foreach $vo.list as $goods}
                    <div class="layui-row" style="line-height:23px">
                        <div class="layui-col-xs6 text-center layui-elip font-s10">{:str_replace(['::',';;'],[':',';'],$goods.goods_spec)}</div>
                        <div class="layui-col-xs3 text-center layui-elip color-blue font-s10">{$goods.price_market+0} / {$goods.price_selling+0}</div>
                        <div class="layui-col-xs3 text-center layui-elip color-blue font-s10">{$goods.number_stock+0} / {$goods.number_sales+0}</div>
                    </div>
                    {/foreach}
                </div>
            </td>
            <td class='text-left nowrap'>

                <div class="nowrap margin-bottom-5">
                    {if auth("store/goods/edit")}
                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    {else}
                    <a data-tips-text="您没有编辑商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">编 辑</a>
                    {/if}

                    {if isset($vo.status) and $vo.status eq 1}
                    <!--{if auth("store/goods/forbid")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">下 架</a>
                    <!--{else}-->
                    <a data-tips-text="您没有下架商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">下 架</a>
                    <!--{/if}-->
                    {else}
                    <!--{if auth("store/goods/resume")}-->
                    <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">上 架</a>
                    <!--{else}-->
                    <a data-tips-text="您没有上架商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">上 架</a>
                    <!--{/if}-->
                    {/if}
                </div>

                <div class="nowrap margin-bottom-5">

                    {if auth("store/goods/stock")}
                    <a class="layui-btn layui-btn-sm layui-btn-normal" data-title="商品入库" data-modal='{:url("stock")}?id={$vo.id}'>入 库</a>
                    {else}
                    <a data-tips-text="您没有商品入库的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">入 库</a>
                    {/if}

                    {if auth("store/goods/remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                    {else}
                    <a data-tips-text="您没有删除商品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">删 除</a>
                    {/if}

                </div>

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
